package com.teamin.service.impl.wx;

import java.lang.reflect.Field;
import java.util.List;

public abstract class WXTemplate {

	public static WXTemplate getTemplateById(String templateId) {
//		switch (templateId) {
//		case "_mH4SPe2N2G2i_fzsMsGH0m1PpuyAIujq1zL3TqXcWw":// 个人消息通知
//			return new TaskTemplate();
//		case "D1q9zehMcujUWmNMY88VaxX2TBj-3o8fNOutE8Scnwc":// 申请加入通知
//			return new RequestJoinTemplate();
//		case "K-pGlRnEKNOwUKi3-TSFyCRprnTkucaMNbjy4bjvBOg":// 审核结果通知
//			return new RequestJoinResultTemplate();
//		case "btdNqpIE3cm1YgOFqH6nHTj5WvlvVN03tOiKMEKaV-8":// 邀请通知
//			return new InvitationTemplate();
//		case "_YhPiYntk0oGPaGGCLCWxhpcOryoun4ho1GuTHa9TsQ":// 退出提醒通知
//			return new QuitTemplate();
//		case "O_yhASaCU-XqrOg3-nvbzbQgCkXPAahXsMKXRN99NE0":// 删除通知
//			return new RequestJoinTemplate();
//		}

		return null;
	}

	public void setTemplateValues(List<String> values) {
		Field[] file = this.getClass().getFields();

		if (values == null || file.length != values.size()) {
			return;
		}

		for (int i = 0; i < file.length; i++) {
			try {
				((TemplateValueColor) file[i].get(this)).value = values.get(i);
			} catch (IllegalArgumentException | IllegalAccessException e) {
				e.printStackTrace();
			}
		}
	}
}
